<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:s="http://jboss.com/products/seam/taglib">
   <body>
  
  
  
    <h:form>
      <a4j:include viewId="toolBar.xhtml"/>
     <table width="100%">
      <tr>
       <td valign="top" style="width:80%">
        <rich:datascroller for="licenceTypesTable"/>
        <rich:dataTable id="licenceTypesTable" rows="15" var="lic" value="#{licences}" width="100%">
            <rich:column sortBy="#{lic.description}" style="text-align:center">
                <f:facet name="header">
                    <h:outputText value="#{messages['fina2.description']}" />
                </f:facet>
                <h:outputText value="#{lic.description}" />
            </rich:column>
            <rich:column sortIcon="/images/edit.gif" style="text-align:center">
                <f:facet name="header">
                    <h:outputText value="#{messages['fina2.amend']}" />
                </f:facet>
                <a4j:commandButton disabled="#{(!userSession.hasPermission('fina2.bank.amend'))&amp;&amp;(!roleSession.hasPermission(userSession.currentUser.id,'fina2.bank.amend'))}" action="#{licTypeSession.setSelectedLicType(lic)}" oncomplete="Richfaces.showModalPanel('licenceTypeEditPanel')" image="/images/edit.gif" reRender="editLicenceTypes">
                 
                </a4j:commandButton>
                
            </rich:column>
            <rich:column sortIcon="/images/remove.gif" style="text-align:center">
                <f:facet name="header">
                    <h:outputText value="#{messages['fina2.delete']}"/>
                </f:facet>
                <a4j:commandButton disabled="#{(!userSession.hasPermission('fina2.bank.amend'))&amp;&amp;(!roleSession.hasPermission(userSession.currentUser.id,'fina2.bank.amend'))}" action="#{licTypeSession.setSelectedLicType(lic)}" oncomplete="Richfaces.showModalPanel('confirmation')" image="/images/remove.gif" reRender="removeLicType">
                    
                </a4j:commandButton>
                
            </rich:column>
        </rich:dataTable>
       </td>
      </tr>
     </table>
    </h:form>
    
    <rich:modalPanel id="confirmation" autosized="true" resizeable="false" width="300" >
        <f:facet name="header">
         #{messages['fina2.web.confirm']}
        </f:facet>
        <f:facet name="controls">
         <h:graphicImage value="../images/close.gif"  onclick="Richfaces.hideModalPanel('confirmation')"/>
        </f:facet>
        <h:form>
        <s:div id="removeLicType">
        <table align="center" width="100%" style="font-size:12px">
         <tr>
          <td style="font-size:12px">#{messages['fina2.bank.bankLicenseDeleteQuestion']}</td>
         </tr>
        </table>
        </s:div>
        <rich:spacer height="5px"/>
        <table align="center">
         <tr>
          <td><a4j:commandButton action="#{licTypeSession.removeLicenceType}" value="#{messages['fina2.web.ok']}" style="width:80px" oncomplete="Richfaces.hideModalPanel('confirmation')" reRender="licenceTypesTable"/></td>
          <td><rich:spacer width="3px"/></td>
          <td><a4j:commandButton ajaxSingle="true" onclick="Richfaces.hideModalPanel('confirmation')" value="#{messages['fina2.web.cancel']}" style="width:80px"/></td>
         </tr>
        </table>
        </h:form>
       </rich:modalPanel>
    
    <rich:modalPanel id="licenceTypePanel" autosized="true" resizeable="false" width="400">
     <f:facet name="header">
      #{messages['fina2.bank.licenceType']}
     </f:facet>
     <f:facet name="controls">
      <h:graphicImage value="/images/close.gif" onclick="Richfaces.hideModalPanel('licenceTypePanel')" />
     </f:facet>
     <h:form>
     
     <f:facet name="beforeInvalidField">
       <s:message style="color:red;font-size:12px"/> 
     </f:facet>
     <f:facet name="afterInvalidField">
     
     </f:facet>
     <f:facet name="aroundInvalidField">
      <s:div style="display:block;padding-bottom:12px"/>
     </f:facet>
      <s:div id="licenceTypes">
       <table align="center" style="width:100%;font-size:12px" >
        <tr>
          <td><rich:spacer width="12px" height="12px"/></td>
         </tr>
        <tr>
         <td>#{messages['fina2.description']}</td>
          <td><rich:spacer width="30px"/></td>
          <td><div style="color:red">*</div></td>
          <td>
              <s:decorate>
               <h:inputText value="#{licTypeSession.licType.description}" validator="#{licTypeValidator.validateDescription}" required="true" requiredMessage="#{messages['fina2.pleaseEnterDescription']}" style="width:240px"/>
              </s:decorate>
          </td>
        </tr>
       </table>
       <rich:spacer height="3px"/>
        <table align="center" >
         <tr>
          <td><a4j:commandButton reRender="licenceTypes"  action="#{licTypeSession.addLicenceType()}"  value="#{messages['fina2.web.ok']}" style="width:80px"/></td>
          <td><rich:spacer width="3px"/></td>
          <td><a4j:commandButton onclick="Richfaces.hideModalPanel('licenceTypePanel');return false;" value="#{messages['fina2.cancel']}" style="width:80px"/></td>
         </tr>
        </table>
      </s:div>
      </h:form>
    </rich:modalPanel>
    
    <rich:modalPanel id="licenceTypeEditPanel" autosized="true" resizeable="false" width="400" >
     <f:facet name="header">
      #{messages['fina2.bank.licenceType']}
     </f:facet>
     <f:facet name="controls">
      <h:graphicImage value="/images/close.gif" onclick="Richfaces.hideModalPanel('licenceTypeEditPanel')" />
     </f:facet>
     <h:form>
     
     <f:facet name="beforeInvalidField">
       <s:message style="color:red;font-size:12px"/> 
     </f:facet>
     <f:facet name="afterInvalidField">
     
     </f:facet>
     <f:facet name="aroundInvalidField">
      <s:div style="display:block;padding-bottom:12px"/>
     </f:facet>
      <s:div id="editLicenceTypes">
       <table align="center" style="width:100%;font-size:12px" >
        <tr>
          <td><rich:spacer width="12px" height="12px"/></td>
         </tr>
        <tr>
         <td>#{messages['fina2.description']}</td>
          <td><rich:spacer width="30px"/></td>
          <td><div style="color:red">*</div></td>
          <td>
              <s:decorate>
               <h:inputText value="#{licTypeSession.selectedLicType.description}" validator="#{licTypeValidator.validateDescription}" required="true" requiredMessage="#{messages['fina2.pleaseEnterDescription']}" style="width:240px"/>
              </s:decorate>
          </td>
        </tr>
       </table>
       <rich:spacer height="3px"/>
        <table align="center" >
         <tr>
          <td><a4j:commandButton reRender="editLicenceTypes"  data="#{licTypeSession.success}" action="#{licTypeSession.updateLicenceType()}" oncomplete="if(data)Richfaces.hideModalPanel('licenceTypeEditPanel')" value="#{messages['fina2.web.ok']}" style="width:80px"/></td>
          <td><rich:spacer width="3px"/></td>
          <td><a4j:commandButton onclick="Richfaces.hideModalPanel('licenceTypeEditPanel');return false;" value="#{messages['fina2.cancel']}" style="width:80px"/></td>
         </tr>
        </table>
      </s:div>
      </h:form>
    </rich:modalPanel>
   </body>
</html>